package com.sigmatrix.h5.web.controller.utils;

import java.lang.reflect.Method;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sigmatrix.h5.entity.CodeCirculation;
import com.sigmatrix.h5.service.CodeCirculationService;
import com.sigmatrix.h5.web.BaseController;
import com.sigmatrix.h5.web.args.QueryQrCodeParamV2;

/**
 * 通过codeCirculation测试mybatic常用操作
 * 
 * @author wei.wang
 *
 */
@RestController
@RequestMapping("/util/test/codeCirculation")
public class TestCodeCirculationController extends BaseController {

	@Autowired
	private CodeCirculationService codeCirculationService;

	//
	@PostMapping("/select/qrcode/esecode/{esecode}")
	public List<CodeCirculation> findListByQrCode(HttpServletRequest request,@RequestBody QueryQrCodeParamV2 parm, @PathVariable String esecode) {
		return codeCirculationService.findListByQrCode(parm.getQrCode(), esecode);
//		return codeCirculationService.findListByQrCode(CommonUtils.encodeQRCode(parm.getQrCode()), esecode);
	}
	
	
	public static void main(String[] args) {
//		System.err.println(CommonUtils.encodeQRCode("4VAUBG.Z8TCKCSK*GKW"));
//		System.err.println(CommonUtils.encodeQRCode("NWJ3X:FC+E$IJN-6X38"));
//		System.err.println(CommonUtils.encodeQRCode("4VAUBG.Z8EJ:SUN6SVW"));
//		System.err.println(CommonUtils.encodeQRCode("2*A18VTX911DYUJ7MPZZAD"));
//		System.err.println(CommonUtils.encodeQRCode("8RBV5IC5XEXHSU3NITZS4H"));
		
		ReflectionUtils.doWithMethods(TestSalesAreaController.class, new ReflectionUtils.MethodCallback() {

			@Override
			public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
				System.err.println(method.getName());
			}
		}, ReflectionUtils.USER_DECLARED_METHODS);
		
		
	}
	
	
}
